#include <bits/stdc++.h>

using namespace std;

const int maxn=100005;

inline void read(){
	int r;char c; bool f=0;
	for(c=getchar();c>'9'||c<'0';c=getchar()) if(c=='-') f=1;
	for(r=0;c<='9'&&c>='0';c=getchar()) r=r*10+c-'0';
	if(f) return -r;
	else return r;
}

int fa[maxn];
int find(int x){
	if(fa[x]==x) return x;
	else return fa[x]=find(fa[x]);
}

struct Edge{
	int u,v;bool d;
	const bool operator < (const Edge &e) const{return u<e.u||(u==e.u&&(v==e.v?d<e.d:v<e.v));} 
};
struct Query{bool typ;int u,v;};
Edge edges[maxn];Query queries[maxn];
bool ans[maxn];

int ch[maxn][2],sum[maxn],laz[maxn],val[maxn],cntnode,par[maxn],rev[maxn];
bool rt[maxn];
int sta[maxn],head;
inline void update(int p){sum[p]=val[p]+sum[ch[p][0]]+sum[ch[p][1]];}
inline void pushdown(int p){
	int t;
	if(laz[p]){
		if(t=ch[p][0]) {laz[t]=1;sum[t]=val[t]=0;}
		if(t=ch[p][1]) {laz[t]=1;sum[t]=val[t]=0;}
	}
	if(rev[p]){
		swap(ch[p][0],ch[p][1]);
		if(t=ch[p][0]) rev[t]^=1;
		if(t=ch[p][1]) rev[t]^=1;
	}
	laz[p]=rev[p]=0;
}
void rotate(int p){
	int f=par[p],g=par[f];
	int x=(ch[f][1]==p),y=(ch[g][1]==f);
	int t;
	par[p]=g;
	if(rt[f]) rt[p]=1,rt[f]=0;
	else ch[g][y]=p;
	y=x^1;
	if(t=ch[p][y]) par[t]=f;ch[f][x]=t;
	par[f]=p;ch[p][y]=f;
	update(f);
}
void splay(int p){
	head=0;sta[head++]=p;
	for(int i=p;!rt[i];i=par[i]) sta[head++]=i;
	while(head--) pushdown(sta[head]);
	while(!rt[p]){
		int f=par[p],g=par[f];
		int x=(ch[f][1]==p),y=(ch[g][1]==f);
		if(!rt[f])
			if(x==y) rotate(f);
			else rotate(p);
		rotate(p);
	}
	update(p);
}
void access(int p){
	for(int q=0;p;p=par[q=p]){
		splay(p);
		rt[ch[p][1]]=1;rt[ch[p][1]=q]=0;
		update(p);
	}
}
void makeroot(int p){
	access(p);
	splay(p);
	rev[p]^=1;
}
void link(int x,int y){
	makeroot(x);
	fa[x]=y;
}
void cut(int x){
	splay(x);
	rt[ch[x][0]]=1;
	par[ch[x][0]]=0;
	ch[x][0]=0;
}

char str[5];

int main(){
	int n,m,q;

	n=read();m=read();q=read();
	for(int i=0;i<m;i++) {edges[i].u=read();edges[i].v=read();if(edges[i].u>edges[i].v) swap(edges[i].u,edges[i].v);}
	sort(edges,edges+m);
	for(int i=0;i<q;i++){
		scanf("%s",str);
		queries[i].u=read();
		queries[i].v=read();
		if(*str=='P') queries[i].typ=1;
		else{
			queries[i].typ=0;
			if(queries[i].u>queries[i].v) swap(queries[i].u,queries[i].v);
			lower_bound(edges,edges+m,(Edge){queries[i].u,queries[i].v,0})->d=1;
		}
	}
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=0;i<m;i++){
		if(edges[i].d) continue;
		if(find(edges[i].u)==find(edges[i].v)){
			makeroot(edges[i].u);
			access(edges[i].v);
			splay(edges[i].v);
			laz[edges[i].v]=1;
			sum[edges[i].v]=val[edges[i].v]=0;
		}else{
			fa[find(edges[i].u)]=find(edges[i].v);
			link(edges[i].u,edges[i].v);
		}
	}
	for(Query *cur=queries+q-1;cur>=queries;cur--){
		if(cur->typ){
			ans[cur-queries]=0;
			if(find(cur->u)==find(cur->v)){
				makeroot(cur->u);access(cur->v);splay(cur->v);
				if(!sum[cur->v]) ans[cur-queries]=1;
			}
		}else{
			if(find(cur->u)==find(cur->v)){
				makeroot(cur->u);access(cur->v);splay(cur->v);
				laz[cur->v]=1;sum[cur->v]=val[cur->v]=0;
			}else{
				fa[find(cur->u)]=find(cur->v);
				link(cur->u,cur->v);
			}
		}
	}

	for(int i=0;i<q;i++) if(queries[i].typ) printf("%s\n",ans[i]?"NIE":"TAK");
	return 0;
}






